<?php if (!defined('insite')) die("no access"); 

$gettime = time();
$filetime = @filemtime("_dat/cach/top5guild");
if(!$topstr1 || ($gettime-$filetime >$config["top5g"]))
{
	ob_start();
	$gtop_r = $db->query("SELECT TOP 5 G_Name,G_Mark, G_Master FROM Guild  order by G_Score desc,G_Count desc,G_Name desc ");
	$content = new content();
	$content->out_content("theme/".$config["theme"]."/them/top5guild_h.them");
	$content->set('|siteaddress|', $config["siteaddress"]);
	while ($show_g = $db->fetcharray($gtop_r))
	{
		$show_g["G_Mark"] = GuildLogo($show_g["G_Mark"],$show_g["G_Name"],12,$config["logotime"]);
		$content->set('|G_Mark|', $show_g["G_Mark"]);
		$content->set('|G_Name|', $show_g["G_Name"]);
		$content->out_content("theme/".$config["theme"]."/them/top5guild_c.them");
	}
	$content->out_content("theme/".$config["theme"]."/them/top5guild_f.them");
	$bufer = ob_get_contents();
	write_catch("_dat/cach/top5guild",$bufer);ob_end_clean(); echo $bufer;
}else require "_dat/cach/top5guild";